home *** CD-ROM | disk | FTP | other *** search
- Path: Norway.EU.net!usenet
- From: patrick.hanevold@login.eunet.no (Patrick Hanevold)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Random Number Generation
- Date: 22 Feb 1996 07:02:34 GMT
- Organization: EUnet Norway
- Message-ID: <1294.6626T458T498@login.eunet.no>
- References: <199602071623.QAA00075@sable.ox.ac.uk> <Pine.OSF.3.91.960207175121.20357B-100000@hai.hiMolde.no>
- <19960207.41F660.11A72@aj050.du.pipex.com> <1100.6613T1273T666@himolde.no>
- <692.6619T1254T1752@in.net> <4g2bi9$1fls@rs18.hrz.th-darmstadt.de>
- <19 <4ge27m$snj@daily-planet.execpc.com>
- NNTP-Posting-Host: pc9.asker-pm2-1.eunet.no
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
-
-
- >: In theory, this is a very good suggestion. In practice, rand() is a
- >: very poor RNG. Run any common statistical tests on rand()'s output
- >: to see.
-
- >The way that the orginal posting started by using srand() to the time,
- >one when using rand() gets a more random number (at least the random
- >numbers don't repeat in the same order each time.)
-
- Here is a new one:
-
- >Jeg har h°rt rykter om at noen svarte pσ mitt kall om en random rutine
- >(C/Asm)?!?! I sσfall har jeg gσtt glipp av det! :)
-
- >Kan den personen slenge opp rutina en gang til?
-
- >Takk...
-
-
- ; By Patrick Hanevold 5/1-1996
-
- SetSeed MACRO
- move.w \1,rndbuf
- ENDM
-
- RND MACRO
- move.w (a0),\1
- move.w 2(a0,\1.l*2),\1
- move.w \1,(a0)
- ENDM
-
- Test SetSeed #1996
- bsr InitRND
- lea rndbuf,a0
- clr.l d0
- RND d0
- rts
-
- InitRND lea rndbuf,a0
- move.w (a0)+,d0 ; Seed
- move.w #-1,d7
- moveq #0,d1
- .loop move.w d0,d1
- mulu #9377,d0
- add.w #9439,d0
- move.w d0,(a0,d1.l*2)
- dbra d7,.loop
- rts
-
- section BSS,BSS
- rndbuf ds.w $10001
-
- <sb>Patrick Hanevold - Virtual Reality developer
- <sb>patrick.hanevold@login.eunet.no
- <sb>Amiga and official Be developer
-
-